﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UtilZ.Dotnet.Ex.ZLog;

namespace UtilZ.Dotnet.Ex.Communication.Net.Ftp
{
    /// <summary>
    /// 获得服务器支持的特性列表
    /// RFC 2389	Get the feature list implemented by the server.
    /// </summary>
    internal class FtpFEATCommand : FtpCommandAbs
    {
        /***********************************************************************************************************
        *
        *
        ************************************************************************************************************/


        public FtpFEATCommand()
            : base()
        {

        }

        protected override string[] GetNames()
        {
            return new string[] { FtpCommands.FEAT };
        }

        protected override IFtpResponse PrimitiveExcute(FtpSession session, string command, string commandLine)
        {
            //Request: FEAT
            //Response: 211-Extended features supported:
            //Response:  LANG EN*
            //Response:  AUTH TLS;TLS-C;SSL;TLS-P;
            //Response:  HOST
            //Response:  SIZE
            //

            //Request: FEAT
            //Response: 211-Extended features supported:
            //Response:  LANG EN*
            //Response:  AUTH TLS;TLS-C;SSL;TLS-P;
            //Response:  HOST
            //Response:  SIZE
            //Response:  MDTM
            //Response:  REST STREAM
            //Response:  211 END

            session.Send(new FtpTextResponse("211-Extended features supported:"));
            //session.Send(new FtpTextResponse("LANG EN*"));
            //session.Send(new FtpTextResponse("AUTH TLS;TLS-C;SSL;TLS-P;"));
            //session.Send(new FtpTextResponse("HOST"));
            session.Send(new FtpTextResponse("SIZE"));
            session.Send(new FtpCodeResponse(FtpStatusCodes.Code211, "END"));

            return null;
        }
    }

}
